package com.igeek.boot.mapper;

import com.igeek.boot.entity.ZhrjAlarmInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 事件表 Mapper 接口
 * </p>
 *
 * @author fengqq
 * @since 2024-08-23
 */
public interface ZhrjAlarmInfoMapper extends BaseMapper<ZhrjAlarmInfo> {

    @Select("<script>" +
            "select a.*,d.dept_name,m.display_value " +
            "from zhrj_alarm_info a join zhrj_dept d " +
            "on a.dept_id=d.dept_id " +
            "join zhrj_menu m " +
            "on a.event_type=m.actual_value " +
            "<where>"+
            "and m.menu_name='event_type' " +
            "<if test='wanIp!=null and wanIp!=\"\"'>and a.wan_ip=#{wanIp}</if> "+
            "<if test='deptId!=null and deptId!=\"\"'>and a.dept_id=#{deptId}</if> "+
            "<if test='eventType!=null and eventType!=\"\"'>and a.event_type=#{eventType}</if> "+
            "</where>"+
            "</script>")
    List<ZhrjAlarmInfo> findAllAlarmInfo(@Param("wanIp") String wanIp, Long deptId, Integer eventType);
}
